// import './assets/main.css'

import { createApp,createVNode,render} from 'vue'
import App from './App.vue'
// 引入路由
import router from "@/router"
// 引入  vuex状态管理store
import store from "@/vuex/store.js"


 

// 1、引入LoadingBar.vue
import LoadingBar from "@/components/LoadingBar.vue"
const Vnode = createVNode(LoadingBar)
render(Vnode,document.body)

// 2、路由前置守卫
router.beforeEach((to,from,next)=>{
    Vnode.component?.exposed?.startLoading()
    next()
})

// 3、路由后置守卫
router.afterEach((to,from)=>{
    Vnode.component?.exposed?.endLoading()
})


let app = createApp(App)
app.use(router)  //注册路由
app.use(store)  //注册vuex仓库  store
app.mount('#app')
